<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>学生注册</title>
	<link rel='stylesheet' href='CSS/decorator1.css'>
</head>

<body>
	<h1>学生成绩&nbsp;<img src="Image/logo.png" class="logo">&nbsp;管理系统</h1>
    <hr>

    <form action="studentRegist-do.jsp" method="post" name="registerForm" class="regist">
    <h1 class="form-title">注册表单</h1>
    <p>I would like to receive your fine publication.</p>
    
        <ul>
            <li>
                <label>您的学号：</label>
                <input type="number" name="sid" id="sid" placeholder="190305*****" required>
            </li>
            <li>
                <label>您的密码：</label>
                <input type="password" name="psd" id="psd" placeholder="********" required>
            </li>
            <li>
                <label>确认密码：</label>
                <input type="password" name="relpassword" id="relpassword" placeholder="********" required
            </li>
            <li>
                <label>您的姓名：</label>
                <input type="text" name="sname" id="sname" placeholder="王小明" required>
            </li>
            <li>
                <label>年级：</label>
                <input type="number" name="grade" id="grade" placeholder="2018/2019/..." required>
            </li>
            <li>
                <label>专业：</label>
                <input type="text" name="major" id="major" placeholder="计科/软件工程/..." required>
            </li>
          </ul>
          <p>
                <input type="submit" onclick="return checkForm()" value="注册">
                <input type="reset">
                <a href="index.jsp" >返回登录页面</a>
            </p>
     </form>   

    <script type="text/javascript">
        function checkForm() {
        	var sid = registerForm.sid.value;
            var sname = registerForm.sname.value;
            var psd = registerForm.psd.value;
            var repwd = registerForm.relpassword.value;
            var grade = registerForm.grade.value;
            var major = registerForm.major.value;
            //alert(name + pwd + repwd);
            if (sname == "" || sname == null) {
                alert("请输入姓名");
                registerForm.sname.focus();
                return false;
            }else if (sid == "" || sid == null) {
                alert("请输入学号");
                registerForm.sid.focus();
                return false;
            }else if (psd == "" || psd == null) {
                alert("请输入密码");
                registerForm.psd.focus();
                return false;
            } else if (repwd == "" || repwd == null) {
                alert("请输入确认密码");
                registerForm.relpassword.focus();
                return false;
            } else if (psd != repwd) {
                alert("两次密码输入不一致，请重新输入!");
                registerForm.relpassword.focus();
                return false;
            }else if (grade == "" || grade == null) {
                alert("请输入年级");
                registerForm.grade.focus();
                return false;
            }else if (major == "" || major == null) {
                alert("请输入专业");
                registerForm.major.focus();
                return false;
            }
            alert('注册成功！');
            return true;
        }
    </script>
</body>
</html>